package Hash;

public class 赎金信 {
    public boolean canConstruct(String ransomNote, String magazine) {
        if (ransomNote.length() > magazine.length()) return false;
        int[] nums = new int[26];
        for (char ch : ransomNote.toCharArray()) nums[ch - 'a']--;
        for (char ch : magazine.toCharArray()) nums[ch - 'a']++;
        for (int num : nums) if (num < 0) return false;
        return true;
    }
}
